package lab03.Test11;

import java.sql.*;

/**
 * Created by LENOVO on 2017/12/13.
 */
public class test {

        public static void main(String[] args) {

            Connection connection=null;
            Statement statement=null;
            ResultSet resultSet=null;

            String sql1="insert into t_users(id,username,password,register_datetime) " +
                    "values(1,'admin','admin',99231231)";
            String sql2="insert into t_users(id,username,password,register_datetime) " +
                    "values(2,'chen','123456',92312321)" ;
            try {
                Class.forName("com.mysql.jdbc.Driver");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            try {
                connection= DriverManager.getConnection(
                        "jdbc:mysql://localhost:3306/java_2017?serverTimezone=UTC",
                        "root",
                        "1234567");
                statement=connection.createStatement();
                statement.execute(sql1);
                statement.execute(sql2);
            } catch (SQLException e) {
                e.printStackTrace();
            }
            finally {
                try{
                    connection.close();
                    statement.close();}
                catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }

